package versi.vitro.oaiserviceprovider.service.jena.impl;

import org.testng.annotations.Test;

import versi.vitro.oaiserviceprovider.test.BaseTestCase;

import com.hp.hpl.jena.rdf.model.ModelMaker;

public class JenaServiceIntegrationTest extends BaseTestCase {

    private final String newModelName = "testNewModel";

    @Test
    public void runTests() throws Exception {
	testModelMakerOperation();
	testCreateModelOperation();
	testClearModelOperation();
	testDeleteModelOperation();
    }

    private void testModelMakerOperation() throws Exception {
	ModelMaker modelMaker = getModelMaker();

	assert null != modelMaker;

	getJenaService().setModelMaker(modelMaker);
    }

    private void testCreateModelOperation() throws Exception {
	getJenaService().createModel(newModelName);
	assert null != getModelBuilder().createOntologyModelFromName(newModelName);
    }

    private void testClearModelOperation() throws Exception {
	getJenaService().clearModel(newModelName);
	assert 0 == getModelBuilder().createOntologyModelFromName(newModelName).size();
    }

    private void testDeleteModelOperation() throws Exception {
	getJenaService().deleteModel(newModelName);
    }
}
